import groovy.jmx.builder.modelmbean.ModelMBeanOperationCollector

class ModelMBeanOperationCollectorTest extends GroovyTestCase {
    def dataGenerator
    def collector

    void setUp() {
        dataGenerator = new NodeDataGenerator()
        collector = new ModelMBeanOperationCollector()
    }

    void testCollectOpInfoFromNodeData() {
        def treeNode = dataGenerator.generateMBeanNodeData()
        assert treeNode != null

        def info = collector.collectOperationInfo(treeNode)
        assert info != null
        assert info.size() == 2
    }

    void testCollectOpInfoFromInstance() {
        def instance = new ExposedTestBean()
        def info = collector.collectOperationInfo(instance)
        assert info != null
        assert info.size() == 4
    }

    void testCollectOpInfoFromJavaInstance() {
        def instance = new TestJavaBean()
        def info = collector.collectOperationInfo(instance)
        assert info != null
        assert info.size() == 2
    }
}